package com.ywy.bootadmin.common.enums;

/**
 * 任务状态枚举
 *
 * @author ywy
 * @date 2022/1/7 17:40
 */
public enum TaskStatusEnum {
    STOP(0, "停止"),
    RUNNING(1, "运行");

    private Integer code;
    private String value;

    TaskStatusEnum(Integer code, String value) {
        this.value = value;
        this.code = code;
    }

    public static TaskStatusEnum getEnumByKey(Integer key) {
        for (TaskStatusEnum e : TaskStatusEnum.values()) {
            if (e.getCode() == key) {
                return e;
            }
        }
        return null;
    }

    /** 获取value */
    public String getValue() {
        return value;
    }

    /** 获取code */
    public Integer getCode() {
        return code;
    }
}
